// (C) Copyright 2006 Marvell International Ltd.
// All Rights Reserved
//

#include "gcu_proxy_extern.h"
#include "gcu_drv_escape.h"


GCUProxyExtern::GCUProxyExtern()
{
    dc = GetDC(NULL);

    ExtEscape(dc, REGISTER_GCU_CLIENT, 0, NULL, sizeof(DWORD), (LPSTR)&client_id);
}

GCUProxyExtern::~GCUProxyExtern()
{
    ExtEscape(dc, UNREGISTER_GCU_CLIENT, sizeof(DWORD), (LPCSTR)&client_id, 0, NULL);
}


bool GCUProxyExtern::submit(UINT32* context_buf, UINT32 context_size, 
                      UINT32* cmd_buf, UINT32 cmd_size)
{
    GCUClientData client_data = { client_id, context_buf, context_size, cmd_buf, cmd_size };

    return ExtEscape(dc, SUBMIT_GCU_CMD_BUF, sizeof(client_data), (LPSTR)&client_data, 0, NULL) > 0;
}


GCUClient* create_extern_gcu_client()
{
    GCUProxyExtern* proxy = new GCUProxyExtern();
    return new GCUClient(proxy, 0x4000);
}
